import { request } from "./request";
const preUrl = "/certificate";
//身份证照上传
export function uploadIdcard(query) {
  return request({
    url: preUrl + `/preApply/uploadIdcard`,
    method: "post",
    data: query,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
}

//身份证照上传
export function preOpen(query) {
  return request({
    url: preUrl + `/preApply/preOpen`,
    method: "get",
    params: query,
  });
}

//获取身份证信息
export function preApply(query) {
  return request({
    url: preUrl + `/preApply`,
    method: "get",
    params: query,
  });
}

//新增预申请
export function onPreApply(query) {
  return request({
    url: preUrl + `/preApply`,
    method: "post",
    data: query,
  });
}

//签名上传
export function uploadSignature(query) {
  return request({
    url: preUrl + '/upload/uploadSignatureByApp',
    method: "post",
    data: query,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
      // 'Content-Type': 'multipart/form-data',
    },
  });
}
//事项校验
export function verifyApply(query) {
  return request({
    url: preUrl + "/matter/verifyApply",
    method: "post",
    data: query,
  });
}

//校验事项
export function verifySubmitApply(query) {
  return request({
    url: preUrl + "/matter/verifySubmitApply",
    method: "post",
    data: query,
  });
}

//业务规则配置--获取事项选项列表（条件）
export function findListGetMatter() {
  return request({
    url: preUrl + `/rulesBiz/getMatter`,
    method: "get",
  });
}

//获取所有字典
export function generateDictMap(query) {
  return request({
    url: preUrl + `/dictionary/generateDictMap`,
    method: "get",
    params: query,
  });
}

export function getTreeData(query) {
  return request({
    url: preUrl + "/region/findList",
    method: "get",
    params: query,
  });
}

export function getAreaDetail(query) {
  return request({
    url: preUrl + `/region/${query}`,
    method: "get",
  });
}

//获取居民身份证
export function getIdcard(query) {
  return request({
    url: preUrl + `/share/getIdcard`,
    method: "post",
    data: query,
  });
}

//获取居民照片
export function getAvatar(query) {
  return request({
    url: preUrl + `/share/getAvatar`,
    method: "post",
    data: query,
  });
}

//获取居民照片
export function getLiveCert(query) {
  return request({
    url: preUrl + `/share/getLiveCert`,
    method: 'post',
    data: query,
  })
}

//新增办证件
export function newCertApi(query) {
    return request({
      url: preUrl + '/newCert',
      method: 'post',
      data: query,
    })
  }

//新增变更
export function changeApi (query) {
  return request({
      url: preUrl+`/change`,
      method: 'post',
      data:query
  })
}

//新增残损换新
export function damagedApi (query) {
  return request({
      url: preUrl+`/damaged`,
      method: 'post',
      data:query
  })
}

//遗失补办
export function lostApi (query) {
  return request({
      url: preUrl+`/lost`,
      method: 'post',
      data:query
  })
}

//迁移
export function moveApi (query) {
  return request({
      url: preUrl+`/move`,
      method: 'post',
      data:query
  })
}

//注销
export function destroyApi (query) {
  return request({
      url: preUrl+`/destroy`,
      method: 'post',
      data:query
  })
}


//地址列表
export function findPageAddress(query) {
  return request({
    url: preUrl + '/address/findPage',
    method: 'get',
    params: query,
  })
}

//新增地址
export function Address(query) {
  return request({
    url: preUrl + '/address',
    method: 'post',
    data: query,
  })
}
//修改地址
export function editAddress(query) {
  return request({
    url: preUrl + '/address',
    method: 'put',
    data: query,
  })
}
//删除地址
export function removeAddress(query) {
  return request({
    url: preUrl + '/address',
    method: 'delete',
    params: query,
  })
}


//获取省份
export function findListByParentId() {
  return request({
    url: preUrl + `/region/findListByParentId`,
    method: 'get',
  })
}


//获取注销的原因
export function findDestroyReason(query) {
  return request({
    url: preUrl + '/dictionary/findDestroyReason',
    method: 'get',
    params: query,
  })
}

//获取身份证信息-新
export function preApplyApi(query) {
  return request({
    url: preUrl + `/preApply`,
    method: "get",
    params: query,
  });
}
